import { Tree } from "../../Data"
import { ITable } from "../inter"


export class UseTable {
    constructor(column: ITable.ColumnItem[]) {
        this.column = column;
        this.columnMap = Tree.flatten(column)
        this.columnLeafs = Tree.leafs(this.columnMap)
    }
    //
    column
    columnMap
    columnLeafs
    //
    search: string[] = []
    //
    header: any[] = []
    // 隐藏的列
    hideCol: string[] = []
    // 生成 search
    initSearch() {
        for(const d of this.columnMap.values()){
            if(!Array.isArray(d)){
                //
                const data = d.data;
                if(data?.search != undefined && data?.search != false){
                    this.search.push(d.id);
                }
            }
        }
    }
    // 生成 header
    initHeader() { }
    // [{name,label,sort,filter,filterList,children}]

    // 生成 grid 布局
}